<!DOCTYPE HTML>
<html>
 <head>
  <title>Web Storage</title>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
 </head>
 <body>
    <h1>storage_session_getItem</h1>
    <div id="log"></div>
    <script>
        test(function() {
            sessionStorage.clear();
            sessionStorage.setItem("undefined", "foo");
            sessionStorage.setItem("null", "bar");
            sessionStorage.setItem("", "baz");
            test(function() {
                assert_equals(sessionStorage.length, 3);
            }, "All 3 items should be added.");
            test(function() {
                assert_equals(sessionStorage["unknown"], undefined, "sessionStorage['unknown']")
                assert_equals(sessionStorage["undefined"], "foo", "sessionStorage['undefined']")
                assert_equals(sessionStorage["null"], "bar", "sessionStorage['null']")
                assert_equals(sessionStorage[undefined], "foo", "sessionStorage[undefined]")
                assert_equals(sessionStorage[null], "bar", "sessionStorage[null]")
                assert_equals(sessionStorage[""], "baz", "sessionStorage['']")
            }, "array access should be correct");
            test(function() {
                assert_equals(sessionStorage.getItem("undefined"), "foo", "sessionStorage.getItem('undefined')")
                assert_equals(sessionStorage.getItem("null"), "bar", "sessionStorage.getItem('null')")
                assert_equals(sessionStorage.getItem(undefined), "foo", "sessionStorage.getItem(undefined)")
                assert_equals(sessionStorage.getItem(null), "bar", "sessionStorage.getItem(null)")
                assert_equals(sessionStorage.getItem(""), "baz", "sessionStorage.getItem('')")
            }, "getItem should be correct")
        });
    </script>
 </body>
</html>
